﻿<cw:DialogWindow
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:am="clr-namespace:AppManager"
    xmlns:amvm="clr-namespace:AppManager.Classes.ViewModel"
	xmlns:cw="clr-namespace:CommonLib.Windows;assembly=CommonLib"
	x:Class="AppManager.WndAppManager"
	x:Name="AppsManagerWindow"
	mc:Ignorable="d"
	Title="{x:Static am:Strings.APP_MANAGER}"
	Width="460"
	Height="542"
	WindowStartupLocation="CenterOwner"
	ShowInTaskbar="False"
	MinWidth="250"
	MinHeight="300"
	Icon="/AppManager;component/Resources/1leftarrow_1159.ico"
	Activated="AppsManagerWindow_Activated" Loaded="AppsManagerWindow_Loaded">

	<Window.Resources>
		<Style
			x:Key="AppTypeItemStyle"
			TargetType="ListBoxItem">
			<!--<Setter Property="Background" Value="Transparent"/>
            <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="Padding" Value="2,0,0,0"/>-->
			<Setter
				Property="Template">
				<Setter.Value>
					<ControlTemplate
						TargetType="{x:Type ListBoxItem}">
						<Border
							x:Name="Bd"
							SnapsToDevicePixels="true"
							Background="{TemplateBinding Background}"
							BorderBrush="{TemplateBinding BorderBrush}"
							BorderThickness="{TemplateBinding BorderThickness}"
							Padding="{TemplateBinding Padding}">
							<ContentPresenter
								HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
								VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
								SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
						</Border>
						<ControlTemplate.Triggers>
							<Trigger
								Property="IsSelected"
								Value="true">
								<!--<Setter Property="Foreground" Value="Red"/>-->
								<Setter
									Property="Background"
									TargetName="Bd"
									Value="#FFB0CCF7" />
							</Trigger>
							<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition
										Property="IsSelected"
										Value="true" />
									<Condition
										Property="Selector.IsSelectionActive"
										Value="false" />
								</MultiTrigger.Conditions>
								<Setter
									Property="Background"
									TargetName="Bd"
									Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
								</Setter>
								<Setter
									Property="Foreground"
									Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
							</MultiTrigger>
							<Trigger
								Property="IsEnabled"
								Value="false">
								<Setter
									Property="Foreground"
									Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style
			x:Key="AppItemStyle"
			TargetType="ListBoxItem">
			<Setter Property="HorizontalContentAlignment" Value="Stretch" />
			<Setter
				Property="Template">
				<Setter.Value>
					<ControlTemplate
						TargetType="{x:Type ListViewItem}">
						<Border
							x:Name="Bd"
							SnapsToDevicePixels="true"
							Background="{TemplateBinding Background}"
							BorderBrush="{TemplateBinding BorderBrush}"
							BorderThickness="{TemplateBinding BorderThickness}"
							Padding="{TemplateBinding Padding}">
							<GridViewRowPresenter
								HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
								VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
								SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
						</Border>
						<ControlTemplate.Triggers>
							<Trigger
								Property="IsSelected"
								Value="true">
								<!--<Setter Property="Foreground" Value="#FFDFDFDF"/>-->
								<Setter
									Property="Background"
									TargetName="Bd"
									Value="#FFB0CCF7" />
							</Trigger>
							<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition
										Property="IsSelected"
										Value="true" />
									<Condition
										Property="Selector.IsSelectionActive"
										Value="false" />
								</MultiTrigger.Conditions>
								<Setter
									Property="Background"
									TargetName="Bd"
									Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
								<Setter
									Property="Foreground"
									Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
							</MultiTrigger>
							<Trigger
								Property="IsEnabled"
								Value="false">
								<Setter
									Property="Foreground"
									Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<DataTemplate
			x:Key="AppTypeInfo">
			<StackPanel
				x:Name="Back"
				Orientation="Vertical"
				Margin="4,4,0,4">
				<TextBlock
					Name="TbAppTypeName"
					Text="{Binding Path=AppTypeName}"
					Initialized="TbAppTypeName_Initialized"
					/>
				<TextBlock
					Name="TbAppTypeInfo"
					Initialized="TbAppTypeInfo_Initialized"
					Text="{Binding Path=AppTypeInfo}"
					Foreground="#FF7A7979" />
			</StackPanel>
		</DataTemplate>
		<DataTemplate
			x:Key="EditableAppInfo">
			<Border
				Name="Back"
				BorderThickness="0,0,0,1"
				BorderBrush="#FFADADAD"
				Padding="0,2" d:DesignWidth="368" d:DesignHeight="74.83" Width="Auto" Height="Auto">
				<Grid
					Name="GridT" Width="Auto">
					<Grid.RowDefinitions>
						<RowDefinition
							Height="Auto" />
						<RowDefinition
							Height="Auto" />
						<RowDefinition
							Height="Auto" />
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition
							Width="40"
							MaxWidth="40" />
						<ColumnDefinition Width="Auto" MinWidth="51.072" />
						<ColumnDefinition Width="*"/>
						<ColumnDefinition Width="Auto" />
					</Grid.ColumnDefinitions>
					<Image
						Grid.RowSpan="3"
						Source="{Binding Path=AppImage, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
						Width="24"
						Height="24" Margin="8,8,8,0" HorizontalAlignment="Left" VerticalAlignment="Top" />
					<TextBox
						Grid.Column="2"
						Text="{Binding Path=AppName, Mode=TwoWay}"
						HorizontalAlignment="Stretch"
						VerticalAlignment="Center"
						GotFocus="TextBox_GotFocus"
						Background="Transparent" BorderThickness="0,0,0,1" Grid.ColumnSpan="1" Margin="8,0,0,0">
						<TextBox.BorderBrush>
							<SolidColorBrush Color="#99D4D0C8"/>
						</TextBox.BorderBrush>
					</TextBox>
					<!--<TextBlock TextTrimming="WordEllipsis" Grid.Column="1" x:Name="AppItemPath" Grid.Row="1" Text="{Binding Path=AppPath, Mode=TwoWay}" Margin="4,4,0,0" HorizontalAlignment="Left"/>-->
					<TextBox
						Grid.Column="2"
						Grid.ColumnSpan="2"
						Grid.Row="1"
						x:Name="AppItemPath"
						Text="{Binding Path=ExecPath, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
						HorizontalAlignment="Stretch"
						GotFocus="TextBox_GotFocus"
						Background="Transparent" BorderThickness="0,0,0,1" Margin="8,0,0,0" VerticalAlignment="Center">
						<TextBox.BorderBrush>
							<SolidColorBrush Color="#99D4D0C8"/>
						</TextBox.BorderBrush>
					</TextBox>
					<TextBox
						Grid.Column="2"
						Grid.ColumnSpan="2"
						Grid.Row="2"
						x:Name="AppItemIconPath"
						HorizontalAlignment="Stretch"
                        Text="{Binding Path=ImagePath, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
						GotFocus="TextBox_GotFocus"
						Background="Transparent" BorderThickness="0,0,0,1" Margin="8,0,0,0" VerticalAlignment="Center"
                        >
						<TextBox.BorderBrush>
							<SolidColorBrush Color="#99D4D0C8"/>
						</TextBox.BorderBrush>
					</TextBox>
					<StackPanel Orientation="Horizontal" Grid.Column="3" Margin="0,0,0,-2.499">
						<Button
						    x:Name="AppItemRemove"
                            Height="18"
						    Width="28"
                            VerticalAlignment="Top"
						    ToolTip="{x:Static am:Strings.REMOVE_LINK}"
                            PreviewMouseUp="AppItemRemove_MouseUp"
                            GotFocus="TextBox_GotFocus"
						    >
							<Image Stretch="None" Source="/AppManager;component/Resources/edit_remove_14_12.png"></Image>
						</Button>
						<Button
						    x:Name="AppItemPathSelect"
                            Height="18"
						    Width="28"
                            VerticalAlignment="Top"
						    ToolTip="{x:Static am:Strings.SELECT_APP}"
                            PreviewMouseUp="AppItemPathSelect_PreviewMouseUp"
                            GotFocus="TextBox_GotFocus"
						    >
							<Image Source="/AppManager;component/Resources/view_remove_1232_16.png" Stretch="None"></Image>
						</Button>
						<Button
						    x:Name="AppItemIconPathSelect"
                            Height="18"
						    Width="28"
                            VerticalAlignment="Top"
						    ToolTip="{x:Static am:Strings.CHANGE_ICON}"
                            PreviewMouseUp="AppItemIconPathSelect_PreviewMouseUp"
                            GotFocus="TextBox_GotFocus"
                            >
							<Image Source="/AppManager;component/Resources/kcoloredit_1364_16.png" Stretch="None"></Image>
						</Button>
					</StackPanel>
                    <Label Margin="0" Content="{x:Static am:Strings.LBL_APP_NAME}" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                    <Label Margin="0" Content="{x:Static am:Strings.LBL_APP_PATH}" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                    <Label Margin="0" Content="{x:Static am:Strings.LBL_APP_IMAGE_PATH}" Grid.Column="1" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Left"/>
				</Grid>
			</Border>
		</DataTemplate>
		<DataTemplate
			x:Key="SemiEditableAppInfo">
			<Border
				Name="BorderT"
				BorderThickness="0,0,0,1"
				BorderBrush="#FFADADAD"
				Padding="0,0,0,4">
				<Grid
					Name="GridT">
					<Grid.RowDefinitions>
						<RowDefinition
							Height="50*" />
						<RowDefinition
							Height="50*" />
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition
							Width="40" />
						<ColumnDefinition
							Width="*" />
					</Grid.ColumnDefinitions>
					<Image
						Grid.RowSpan="2"
						Source="{Binding Path=AppImage, Mode=OneWay}"
						Width="24"
						Height="24" />
                    <TextBlock
						Grid.Column="1"
						Text="{Binding Path=AppName, Mode=OneWay}"
                        Margin="4,4,0,0"
						HorizontalAlignment="Left"
						/>
					<TextBlock
						Grid.Column="1"
                        Grid.Row="1"
						x:Name="AppItemPath"
						Text="{Binding Path=ExecPath, Mode=OneWay}"
						Margin="4,4,0,0"
						HorizontalAlignment="Left" />
				</Grid>
			</Border>
		</DataTemplate>
        <DataTemplate
			x:Key="StatItem">
            <Border
				Name="BorderT"
				BorderThickness="0,0,0,1"
				BorderBrush="#FFADADAD"
				Padding="0,0,0,4">
                <Grid
					Name="GridT">
                    <Grid.RowDefinitions>
                        <RowDefinition
							Height="50*" />
                        <RowDefinition
							Height="50*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition
							Width="40" />
                        <ColumnDefinition>
                            <ColumnDefinition.Width>
                                <Binding Path="RealtiveRuns">
                                    <Binding.Converter>
                                        <amvm:GridSizeConverter />
                                    </Binding.Converter>
                                </Binding>
                            </ColumnDefinition.Width>
                        </ColumnDefinition>
                        <ColumnDefinition>
                            <ColumnDefinition.Width>
                                <Binding Path="RealtiveRuns">
                                    <Binding.Converter>
                                        <amvm:GridSizeRelativeConverter />
                                    </Binding.Converter>
                                </Binding>
                            </ColumnDefinition.Width>
                        </ColumnDefinition>
                        <ColumnDefinition
							Width="4" />
                    </Grid.ColumnDefinitions>
                    <Image
						Grid.RowSpan="2"
						Source="{Binding Path=AppInfo.AppImage, Mode=OneWay}"
						Width="24"
						Height="24" />
                    <TextBlock
						Grid.Column="1"
                        Grid.ColumnSpan="2"
						Text="{Binding Path=AppInfo.AppName, Mode=OneWay}"
                        Margin="4,4,0,0"
						HorizontalAlignment="Left"
						/>
                    <TextBlock
						Grid.Column="1"
                        Grid.ColumnSpan="2"
						Text="{Binding Path=RunCount, Mode=OneWay}"
                        Margin="0,4,0,0"
						HorizontalAlignment="Right"
						/>                    
                    <Border
                        Grid.Row="1"
                        Grid.Column="1"
                        Margin="4,4,0,0"
                        Background="DarkBlue"
                        >
                    </Border>
                </Grid>
            </Border>
        </DataTemplate>
        <DataTemplate
			x:Key="ReadOnlyAppInfo">
			<Border
				Name="BorderT"
				BorderThickness="0,0,0,1"
				BorderBrush="#FFADADAD"
				Padding="0,0,0,4">
				<Grid
					Name="GridT">
					<Grid.RowDefinitions>
						<RowDefinition
							Height="50*" />
						<RowDefinition
							Height="50*" />
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition
							Width="40" />
						<ColumnDefinition
							Width="*" />
						<ColumnDefinition
							Width="Auto" />
					</Grid.ColumnDefinitions>
					<Image
						Grid.RowSpan="2"
						Source="{Binding Path=App.AppImage, Mode=OneWay}"
						Width="24"
						Height="24" />
					<TextBlock
						Margin="0,4,0,0"
						Grid.Column="1"
						Width="Auto"
						Background="{x:Null}"
						HorizontalAlignment="Stretch"
						TextTrimming="CharacterEllipsis"
						Text="{Binding Path=App.AppName, Mode=OneWay}" >
					</TextBlock>
					<TextBlock
						x:Name="DelFrom"
						Grid.Column="2"
						Grid.Row="0"
						MaxWidth="160"
						TextTrimming="CharacterEllipsis"
						Margin="16,4,12,4" >
						<TextBlock.Text>
							<Binding Path="." Mode="OneWay">
								<Binding.Converter>
									<am:DeletedAppInfoConverter />
								</Binding.Converter>
							</Binding>
						</TextBlock.Text>
					</TextBlock>
					<TextBlock
						Grid.Column="1"
						Grid.ColumnSpan="2"
						x:Name="AppItemPath"
						Grid.Row="1"
						Text="{Binding Path=App.ExecPath, Mode=OneWay}"
						Margin="4,4,4,4"
						HorizontalAlignment="Left" />
				</Grid>
			</Border>
		</DataTemplate>
	</Window.Resources>

	<TabControl
		Name="AppTabs"
		IsSynchronizedWithCurrentItem="True"
		 Grid.IsSharedSizeScope="True" >
		<TabItem
			Header="{x:Static am:Strings.APP_TYPES}">
			<Grid>
				<Grid.RowDefinitions>
					<RowDefinition
						Height="Auto" />
					<RowDefinition
						Height="*" />
				</Grid.RowDefinitions>
				<ListBox
					ItemTemplate="{StaticResource AppTypeInfo}"
					ItemContainerStyle="{StaticResource AppTypeItemStyle}"
					IsSynchronizedWithCurrentItem="True"
					x:Name="AppTypes"
					Margin="8,0,8,8"
					Grid.Row="1"
					KeyUp="AppTypes_KeyUp"
					SelectionChanged="AppTypes_SelectionChanged" />
				<Grid Margin="8,12,8,12">
					<Grid.ColumnDefinitions>
						<ColumnDefinition
							Width="Auto" />
						<ColumnDefinition
							Width="100*" />
						<ColumnDefinition
							Width="Auto" />
						<ColumnDefinition
							Width="Auto" />
						<ColumnDefinition
							Width="Auto" />
						<ColumnDefinition
							Width="Auto" />
					</Grid.ColumnDefinitions>
					<Grid.RowDefinitions>
						<RowDefinition SharedSizeGroup="toolHeight"/>
					</Grid.RowDefinitions>
					<Label
						Content="{x:Static am:Strings.APP_TYPE_NAME}"
						x:Name="AppTypeLabel"
						HorizontalAlignment="Left"
                        HorizontalContentAlignment="Left"
                        VerticalContentAlignment="Center"
                        Padding="0"
                        Margin="0,0,4,0"
                        />
					<TextBox
						Text="{Binding Path=SelectedItem.AppTypeName, ElementName=AppTypes, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
						x:Name="AppTypeName"
						Grid.Column="1"
						Margin="0,0,4,0"
                        />
					<am:ImageButton
						Grid.Column="2"
                        Margin="4,0,4,0"
						x:Name="BtnAppTypeUp"
						ToolTip="{x:Static am:Strings.GROUP_UP}"
						ButtonImageSource="/AppManager;component/Resources/up_16.png"
						Click="BtnAppTypeUp_Click" 
						/>
					<am:ImageButton
						Grid.Column="3"
						x:Name="BtnAppTypeDown"
						ToolTip="{x:Static am:Strings.GROUP_DOWN}"
						ButtonImageSource="/AppManager;component/Resources/down_16.png"
						Margin="0,0,4,0"
						Click="BtnAppTypeDown_Click"
						/>
					<am:ImageButton
						Grid.Column="4" 
						x:Name="BtnAddAppType"
						Click="BtnAddAppType_Click"
						ToolTip="{x:Static am:Strings.GROUP_ADD}"
						ButtonImageSource="/AppManager;component/Resources/edit_add_1184_16.png"
						Margin="0,0,4,0"
						/>
					<am:ImageButton
						Grid.Column="5"
						x:Name="BtnRemoveAppType"
						ToolTip="{x:Static am:Strings.GROUP_DELETE}"
						Click="BtnRemoveAppType_Click"						
						ButtonImageSource="/AppManager;component/Resources/edit_remove_14_16.png"
						/>
				</Grid>
			</Grid>
		</TabItem>
		<TabItem
			Header="{x:Static am:Strings.APPLICATIONS}">
			<Grid Name="AppTypesApp">
				<Grid.RowDefinitions>
					<RowDefinition
						Height="Auto" />
					<RowDefinition
						Height="*" />
				</Grid.RowDefinitions>
				<Grid Margin="8,12,8,12">
					<Grid.ColumnDefinitions>
						<ColumnDefinition
							Width="*" MinWidth="78" />
						<ColumnDefinition
							Width="Auto" />
						<ColumnDefinition
							Width="Auto" />
						<ColumnDefinition
							Width="Auto" />
						<ColumnDefinition
							Width="Auto" />
					</Grid.ColumnDefinitions>
					<Grid.RowDefinitions>
						<RowDefinition SharedSizeGroup="toolHeight"/>
					</Grid.RowDefinitions>
					<ComboBox
					    Grid.IsSharedSizeScope="True"
					    DisplayMemberPath="AppTypeName"
					    Margin="0,0,4,0"
					    Name="AppTypeSelector"
					    SelectedItem="{Binding ElementName=AppTypes, Path=SelectedItem, Mode=TwoWay}" 
                        />
					<am:ImageButton
						Grid.Column="1"
						x:Name="BtnAppUp"
						ToolTip="{x:Static am:Strings.APP_UP}"
						ButtonImageSource="/AppManager;component/Resources/up_16.png"
						Margin="4,0,4,0"
						Click="BtnAppUp_Click"
						/>
					<am:ImageButton
						Grid.Column="2"
						x:Name="BtnAppDown"
						ToolTip="{x:Static am:Strings.APP_DOWN}"
						ButtonImageSource="/AppManager;component/Resources/down_16.png"
						Margin="0,0,4,0"
						Click="BtnAppDown_Click"
						/>
					<am:ImageButton
						Grid.Column="3"
						x:Name="BtnAddApp" 
						ToolTip="{x:Static am:Strings.APP_ADD}"
						ButtonImageSource="/AppManager;component/Resources/edit_add_1184_16.png"
						Margin="0,0,4,0"
						Click="BtnAddApp_Click"
						/>
					<am:ImageButton
						Grid.Column="4"
						x:Name="BtnRemoveApp"
						ToolTip="{x:Static am:Strings.APP_DELETE}"
						ButtonImageSource="/AppManager;component/Resources/edit_remove_14_16.png"
						Click="BtnRemoveApp_Click"
						/>
				</Grid>
				<ListBox
					Grid.Row="1"
					Margin="8,0,8,8"
					Name="AppList"
					ItemsSource="{Binding ElementName=AppTypeSelector, Path=SelectedItem.AppInfos}"
					HorizontalContentAlignment="Stretch"
					IsSynchronizedWithCurrentItem="True"
					ItemTemplate="{StaticResource EditableAppInfo}"
					ItemContainerStyle="{StaticResource AppTypeItemStyle}"
					ScrollViewer.HorizontalScrollBarVisibility="Disabled"
					SelectionMode="Extended"
					KeyUp="AppList_KeyUp"
					>
					<ListBox.ItemsPanel>
						<ItemsPanelTemplate>
							<VirtualizingStackPanel
								Orientation="Vertical"
								IsItemsHost="True"
								Width="{Binding Path=ActualWidth, 
											RelativeSource={RelativeSource Mode=FindAncestor, 
											AncestorType= {x:Type ScrollContentPresenter}}}" />
						</ItemsPanelTemplate>
					</ListBox.ItemsPanel>
				</ListBox>
			</Grid>
		</TabItem>
		<TabItem
			Header="{x:Static am:Strings.SEARCH}" >
			<Grid
				Height="Auto"
				Width="Auto">
				<Grid.RowDefinitions>
					<RowDefinition
						Height="Auto" />
					<RowDefinition
						Height="100*" />
				</Grid.RowDefinitions>
				<StackPanel>
					<WrapPanel
						Margin="8,12,8,4"
						Orientation="Horizontal"
						>
						<Button
                            MinHeight="24"
							Name="BtnScanQuickLaunch"
							Margin="0,0,4,0"
                            Padding="2,0,2,0"
							Content="{x:Static am:Strings.SCAN_QUICK_LAUNCH}"
							Click="BtnScanQuickLaunch_Click" />
						<Button
                            MinHeight="24"
							Name="BtnScanAllProgs"
							Margin="0,0,4,0"
                            Padding="2,0,2,0"
							Content="{x:Static am:Strings.SCAN_ALL_PROGS}"
							Click="BtnScanAllProgs_Click" />
					</WrapPanel>
					<WrapPanel 
						Grid.Row="1" 
						Orientation="Horizontal"
						Margin="8,4,8,0">
						<CheckBox 
                            Name="ChkExcludeExisting" 
                            Content="{x:Static am:Strings.EXCLUDE_EXISTING}"
                            ToolTip="{x:Static am:Strings.EXCLUDE_EXISTING_INFO}"
                            IsChecked="True"  
                            Margin="0,0,8,0" 
                            />
						<CheckBox 
                            Name="ChkExcludeRecycleBin" 
                            Content="{x:Static am:Strings.EXCLUDE_RECYCLE_BIN}"
                            ToolTip="{x:Static am:Strings.EXCLUDE_RECYCLE_BIN_INFO}"
                            IsChecked="True"
                            />
					</WrapPanel>
					<Grid Margin="8, 6, 8, 12">
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="*"></ColumnDefinition>
							<ColumnDefinition Width="Auto" ></ColumnDefinition>
							<ColumnDefinition Width="Auto"></ColumnDefinition>
							<ColumnDefinition Width="Auto" ></ColumnDefinition>
							<ColumnDefinition Width="Auto" ></ColumnDefinition>
						</Grid.ColumnDefinitions>
						<TextBox Name="TxtFolder" />
						<Button
							Grid.Column="1"
							MinWidth="24"
							Margin="4,0,0,0"
							Name="BtnFolder"
							ToolTip="{x:Static am:Strings.SELECT_PATH}"
							Click="BtnFolder_Click"
						    >...</Button>
						<Button
                            Grid.Column="2"
						    Margin="4,0,0,0"
						    Name="_BtnSearch"
							ToolTip="{x:Static am:Strings.SCAN_PATH}"
						    Content="{x:Static am:Strings.SCAN}"
							Click="BtnSearch_Click"
						     />
						<am:ImageButton
                            Grid.Column="3"
						    Margin="4,0,0,0"
						    x:Name="BtnAddScan"
							ToolTip="{x:Static am:Strings.ADD_SCANNED}"
							ButtonImageSource="/AppManager;component/Resources/edit_add_1184_16.png"
						    Click="BtnAddScan_Click"
						    />
						<am:ImageButton
                            Grid.Column="4"
							x:Name="BtnToRecycleBin"
						    Margin="4,0,0,0"
							ToolTip="{x:Static am:Strings.MOVE_TO_RECYCLE_BIN}"
							ButtonImageSource="/AppManager;component/Resources/trash_16.png"
						    Click="BtnToRecycleBin_Click"
							/>
					</Grid>
				</StackPanel>
				<ListBox
					Margin="8,0,8,8"
					Name="AppScanList"
					Grid.Row="1"
					SelectionMode="Extended"
					HorizontalContentAlignment="Stretch"
					ItemContainerStyle="{StaticResource AppTypeItemStyle}"
					ItemTemplate="{StaticResource SemiEditableAppInfo}"
					>
				</ListBox>
			</Grid>
		</TabItem>
		<TabItem
			Header="{x:Static am:Strings.RECYCLE_BIN}" Name="TabRecycleBin">
			<Grid Name="DeletedApps">
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto" />
					<RowDefinition Height="*" />
				</Grid.RowDefinitions>
                <Grid Margin="8,8,8,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <TextBlock 
                        Grid.Column="0"
                        VerticalAlignment="Center"
                        TextWrapping="Wrap"
                        Margin="0,0,4,0"
                        Text="{x:Static am:Strings.RECYCLE_BIN_TIP}"
                        />
                    <am:ImageButton
                        Grid.Column="1"
					    x:Name="BtnResore"
                        Margin="4,0,4,0"
                        VerticalAlignment="Center"
					    ToolTip="{x:Static am:Strings.RESTORE_APP}"
					    ButtonImageSource="/AppManager;component/Resources/agt_reload_3236_16_green.png"
					    Click="BtnResore_Click"
					    />                    
                    <am:ImageButton
                        Grid.Column="2"
					    x:Name="BtnDeleteFromBin"
                        Margin="0,0,0,0"
                        VerticalAlignment="Center"
					    ToolTip="{x:Static am:Strings.DELETE_FROM_RECYCLE_BIN}"
					    ButtonImageSource="/AppManager;component/Resources/edit_remove_14_16.png"
					    Click="BtnDeleteFromBin_Click"
					    />                    
                </Grid>
				<ListBox
					Grid.Row="1"
					Margin="8,8,8,8"
					Name="DeletedAppList"
					HorizontalContentAlignment="Stretch"
					IsSynchronizedWithCurrentItem="True"
					ItemTemplate="{StaticResource ReadOnlyAppInfo}"
					ItemContainerStyle="{StaticResource AppTypeItemStyle}"
					ScrollViewer.HorizontalScrollBarVisibility="Disabled"
					SelectionMode="Extended"
					>
					<ListBox.ItemsPanel>
						<ItemsPanelTemplate>
							<VirtualizingStackPanel
								Orientation="Vertical"
								IsItemsHost="True"
								Width="{Binding Path=ActualWidth, 
											RelativeSource={RelativeSource Mode=FindAncestor, 
											AncestorType= {x:Type ScrollContentPresenter}}}" />
						</ItemsPanelTemplate>
					</ListBox.ItemsPanel>
				</ListBox>
			</Grid>
		</TabItem>
        <TabItem
            Header="{x:Static am:Strings.APP_STAT}" Name="TabStatistics">
            <ListBox
				Margin="8,8,8,8"
				Name="StatList"
				HorizontalContentAlignment="Stretch"
				IsSynchronizedWithCurrentItem="True"
				ItemTemplate="{StaticResource StatItem}"
				ItemContainerStyle="{StaticResource AppTypeItemStyle}"
				ScrollViewer.HorizontalScrollBarVisibility="Disabled"
				SelectionMode="Extended"
				>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel
								Orientation="Vertical"
								IsItemsHost="True"
								Width="{Binding Path=ActualWidth, 
											RelativeSource={RelativeSource Mode=FindAncestor, 
											AncestorType= {x:Type ScrollContentPresenter}}}" />
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
            </ListBox>
        </TabItem>
	</TabControl>
</cw:DialogWindow>
